/**
 * 
 */
package UnitTest;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import ControlLayer.CustomerCtr;
import ModelLayer.Customer;
import ModelLayer.Discount;

/**
 * @author fonix232
 *
 */
public class CustomerCtrTest {
	
	private Customer customer;
	private CustomerCtr control;
	private Discount discount;

	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		control = new CustomerCtr();
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		
	}

	/**
	 * Test method for {@link ControlLayer.CustomerCtr#getCustomer(int)}.
	 */
	@Test
	public void testGetCustomer() {
		int customerID = control.insertCustomer("Test John", "Test street 237", "JUNit City", 123456789, 9200, "PrivateCustomer", 0);
		Assert.assertEquals(customerID, control.getCustomer(customerID).getId());
		control.deleteCustomer(customerID);
	}

	/**
	 * Test method for {@link ControlLayer.CustomerCtr#insertCustomer(java.lang.String, java.lang.String, java.lang.String, int, int, java.lang.String, int)}.
	 */
	@Test
	public void testInsertCustomer() {
		int customerID = control.insertCustomer("Test John", "Test street 237", "JUNit City", 123456789, 9200, "PrivateCustomer", 0);
		Assert.assertEquals(customerID, control.getCustomer(customerID).getId());
		control.deleteCustomer(customerID);
	}

	/**
	 * Test method for {@link ControlLayer.CustomerCtr#deleteCustomer(int)}.
	 */
	@Test
	public void testDeleteCustomer() {
		int customerID = control.insertCustomer("Test John", "Test street 237", "JUNit City", 123456789, 9200, "PrivateCustomer", 0);
		Assert.assertEquals(1, control.deleteCustomer(customerID));
	}

}
